/**
 * 当前页面是否在微信浏览器中打开
 * @returns {Boolean}
 */
function is_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger") {
        return true;
    } else {
        return false;
    }
}

/**
 * 获取页面中url参数的值
 * if (!isWeixn (window.location.host=="127.0.0.1" || window.location.host=="localhost" ){
 * @param name
 * @returns
 */
function getQueryString(name) {  
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");  
	var r = window.location.search.substr(1).match(reg);  
	if (r != null) return unescape(r[2]); return null;  
}  

/**
 * 手机加密中间4位
 * @param vphone
 * @returns
 */
function encodeMobile(vphone) {
	var reg = /^(\d{3})\d*(\d{4})$/;
	if (vphone==null) {
		vphone = "";
	}
	var encodePhone = vphone.replace(reg,'$1****$2');
	return encodePhone;
}